package com.yjd.bi.user.dao.impl;

import java.util.Map;

import org.springframework.stereotype.Component;

import com.yjd.bi.user.dao.IUserStatisticsDao;
import com.yjd.bi.user.model.UserStatisticsModel;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;

/**
 * <b>description</b>：客户消息订单数据访问层 <br>
 * <b>time</b>：2016-04-12 14:45:09 <br>
 * <b>author</b>： zhoujin
 */
@Component("userStatisticsDao")
public class UserStatisticsDaoImpl extends BaseDaoImpl implements
		IUserStatisticsDao {

	private static final String SQLMAPNAMESPACE = UserStatisticsModel.class
			.getName();
	private static final String PKNAME = "id";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}

	@Override
	public Integer getSummary(Map<String, Object> paramMap) throws Exception {
		return (Integer) this.getSqlMap(false).queryForObject(
				getStatement("getSummary"), paramMap);
	}

	@Override
	public double getFundsSum(Map<String, Object> paramMap, boolean b) {
		Object myObject = this.getSqlMap(b).queryForObject(
				this.getStatement("usersSum"), paramMap);
		if (myObject != null) {
			return Double.parseDouble(myObject.toString());
		}
		return 0.00D;
	}

	@Override
	public Integer wxBindCount(Map<String, Object> paramMap) throws Exception {
		return (Integer) this.getSqlMap(false).queryForObject(
				getStatement("wxBindCount"), paramMap);	}
}
